Add 'floating' suboption to KML writer for pilots. Improve KML doc.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 6 Sep 2005 16:01:43 +0000 (16:01 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 6 Sep 2005 16:01:43 +0000 (16:01 +0000)
gpsbabel/README
gpsbabel/kml.c

index 269aa9dabc28b0d536481c18698ac7910b4778ea..ccd7a176f3b27ada8ef241b059aebec6b94828aa 100644 (file)
@@ -849,9 +849,24 @@ THE FORMATS
 
     KML
 
-       We have sketchy support for KML, the Keyhole Markup Language.
-       There are many features in this file format that we don't yet
-       support, but simple waypoint lists convert fine.
+        KML, the Keyhole Markup Language, is used by Keyhole and
+        Google Earth.  (Google Earth uses GPSBabel internally for
+        receiver communications and several file format imports and
+        exports. There are features in this file format that we
+        don't support such as camera views, but waypoints, tracks, and
+       routes work well.
+
+       Additional options:
+       lines=n (default n=1) Draws lines between points in tracks and 
+               routes when n is non-zero.
+       points=n (default n=1) Draws placemarks for tracks and routes when
+               n is non-zero.
+       line_width=n   (default n=6) Width of drawn lines, in pixels.
+       line_color=n (default=65eeee17) Line colour specified in hex AABBGGRR.
+       floating=n (default n=0) Altitudes are not clamped to ground when
+               n is non-zero.  This option is more useful to pilots than
+               to hikers.
+       
 
     GOOGLE
         
index 834454eb99cec57aad50a0351afb2e1deb0966d4..4eb920cdaf1ec541829a83b0d584f5183ddf14e3 100644 (file)
@@ -28,9 +28,11 @@ static char *opt_export_lines = NULL;
 static char *opt_export_points = NULL;
 static char *opt_line_width = NULL;
 static char *opt_line_color = NULL;
+static char *opt_floating = NULL;
 
 static int export_lines;
 static int export_points;
+static int floating;
 
 static waypoint *wpt_tmp;
 
@@ -61,6 +63,9 @@ arglist_t kml_args[] = {
        {"line_color", &opt_line_color, 
          "Line color, specified in hex AABBGGRR",
          "64eeee17", ARGTYPE_BOOL },
+       {"floating", &opt_floating, 
+        "Altitudes are absolute and not clamped to ground", 
+        "0", ARGTYPE_BOOL },
        {0, 0, 0, 0, 0}
 };
 
@@ -225,6 +230,9 @@ static void kml_output_point(const waypoint *waypointp, const char *style)
        fprintf(ofd, "\t<Placemark>\n");
        fprintf(ofd, "\t  <styleUrl>%s</styleUrl>\n", style);
        fprintf(ofd, "\t  <Point>\n");
+        if (floating) {
+          fprintf(ofd, "\t    <altitudeMode>absolute</altitudeMode>\n");
+        }
        fprintf(ofd, "\t    <coordinates>%f,%f,%f</coordinates>\n",
                pt->longitude, pt->latitude, pt->altitude);
        fprintf(ofd, "\t  </Point>\n");
@@ -252,6 +260,9 @@ static void kml_output_tailer(const route_head *header)
     fprintf(ofd, "\t  <name>Path</name>\n");
     fprintf(ofd, "\t  <MultiGeometry>\n");
     fprintf(ofd, "\t    <LineString>\n");
+    if (floating) {
+      fprintf(ofd, "\t      <altitudeMode>absolute</altitudeMode>\n");
+    }
     fprintf(ofd, "\t      <coordinates>\n");
     for (i = 0; i < point3d_list_len; ++i)
       fprintf(ofd, "%f,%f,%f ", 
@@ -347,6 +358,7 @@ void kml_write(void)
   // Parse options
   export_lines = (0 == strcmp("1", opt_export_lines));
   export_points = (0 == strcmp("1", opt_export_points));
+  floating = (!! strcmp("0", opt_floating));
 
        fprintf(ofd, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
        fprintf(ofd, "<Document xmlns:xlink=\"http://www.w3/org/1999/xlink\">\n");